Skip to content

Add extra eslint rules #541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2025
Merged

Add extra eslint rules #541

merged 2 commits into from
May 20, 2025

Conversation

bonnie57
Copy link
Collaborator

@bonnie57 bonnie57 commented May 16, 2025

Description

  1. Using a single import statement per module will make the code clearer because you can see everything being imported from that module on one line.

Example of incorrect code for this rule:

import { merge } from 'module';
import something from 'another-module';
import { find } from 'module'; //error

  1. Require default cases in switch statements

Example of incorrect code for this rule:

/*eslint default-case: "error"*/

switch (a) {
    case 1:
        /* code */
        break;
}
  1. Require the use of === and !==

Example of incorrect code for this rule:

if (x == 42) { }
  1. Require const declarations for variables that are never reassigned after declared

Example of incorrect code for this rule:

// it's initialized and never reassigned.
let a = 3;
console.log(a);

@bonnie57 bonnie57 changed the title Add ESLint rule to disallow duplicate imports Add extract eslint rules May 16, 2025
@bonnie57 bonnie57 changed the title Add extract eslint rules Add extra eslint rules May 16, 2025
Copy link
Collaborator

@bpolania bpolania left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bonnie57 bonnie57 merged commit 66c9909 into main May 20, 2025
23 checks passed
@bonnie57 bonnie57 deleted the feat/add-no-duplicate-import branch May 29, 2025 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants